<!doctype html>
<html>
    <head>
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
        <script type="module" src="http://localhost:8080/node_modules/@perspective-dev/viewer-datagrid/dist/cdn/perspective-viewer-datagrid.js"></script>
        <script type="module" src="http://localhost:8080/node_modules/@perspective-dev/viewer-d3fc/dist/cdn/perspective-viewer-d3fc.js"></script>
        <link rel="stylesheet" crossorigin="anonymous" href="/node_modules/@perspective-dev/viewer/dist/css/themes.css" />

        <style>
            perspective-viewer {
                position: absolute;
                top: 0;
                left: 0;
                right: 0;
                bottom: 0;
            }
        </style>
    </head>

    <body>
        <perspective-viewer id="viewer" editable></perspective-viewer>

        <script type="module">
            import "/node_modules/@perspective-dev/viewer/dist/cdn/perspective-viewer.js";
            import perspective from "http://localhost:8080/node_modules/@perspective-dev/viewer/dist/cdn/perspective-viewer.js";
            const REQ = fetch("/node_modules/superstore-arrow/superstore.lz4.arrow");

            // Create a client that expects a Perspective server to accept
            // Websocket connections at the specified URL.
            const websocket = await perspective.websocket("ws://localhost:8082/websocket");
            const resp = await REQ;
            const arrow = await resp.arrayBuffer();
            const table = websocket.table(arrow);

            document.getElementById("viewer").load(table);
        </script>
    </body>
</html>
